import net.egork.utils.Solver;
import net.egork.utils.io.InputReader;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

public class Task90B implements Solver {
    public void solve(int testNumber, InputReader in, PrintWriter out) {

        int n = in.readInt();
        int m = in.readInt();

        Vector<String> s = new Vector<String>();
        for (int i = 0; i < n; ++i)
            s.add(in.readString());

        Map<Character, Integer> cn[] = new Map[n];
        Map<Character, Integer> cm[] = new Map[m];
        for (int i = 0; i < n; ++i)
            cn[i] = new HashMap<Character, Integer>();
        for (int j = 0; j < m; ++j)
            cm[j] = new HashMap<Character, Integer>();

        char c;
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j) {
                c = s.elementAt(i).charAt(j);
                cn[i].put(c, (cn[i].get(c) == null ? 0 : cn[i].get(c)) + 1);
                cm[j].put(c, (cm[j].get(c) == null ? 0 : cm[j].get(c)) + 1);
            }

        StringBuilder res = new StringBuilder();
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j) {
                c = s.elementAt(i).charAt(j);
                if (cn[i].get(c) < 2 && cm[j].get(c) < 2)
                    res.append(c);
            }

        out.println(res.toString());
    }
}


